<template>
<div class="setupPage">
    <div class="flex">
        <div style="color: #111; width: 120px;">种草返佣比例</div>
        <el-input style="width: 200px;" v-model="form.communitySettingSettlementRebatePercent"></el-input>
        <div style="color: #111; padding-left: 5px;">%</div>
    </div>

    <div class="flex">
        <div style="color: #111; width: 120px;">提现最低金额</div>
        <el-input style="width: 200px;" v-model="form.communitySettingSettlementMinimumWithdrawalAmount"></el-input>
        <div style="color: #111; padding-left: 5px;">元</div>
    </div>

    <div class="flex">
        <div style="color: #111; width: 120px;">开始冻结规则</div>
        <el-input style="width: 200px;" v-model="communitySettingSettlementFreeze" disabled></el-input>
    </div>

    <div class="flex">
        <div style="color: #111; width: 120px;">冻结时长</div>
        <el-input style="width: 200px;" v-model="form.communitySettingSettlementFreezeDay"></el-input>
        <div style="color: #111; padding-left: 5px;">天</div>
    </div>

    <div class="btn" @click="submit">提交</div>
</div>
</template>

<script>
import { creationSet, creationUpdate } from "@/api/creation"
export default {
    data(){
        return {
            form: {
                communitySettingSettlementFreezeDay: "",
                communitySettingSettlementMinimumWithdrawalAmount: "",
                communitySettingSettlementFreezeType: "1",
                communitySettingSettlementRebatePercent: ""
            },
            communitySettingSettlementFreeze: "订单完成后"
        }
    },
    created(){
        this.getInfo()
    },
    methods: {
        getInfo(){
            creationSet().then(res=>{
                console.log(res)
                this.form = res 
                console.log("种草结算设置", this.form )
            })
        },

        submit(){
            creationUpdate(this.form).then(res=>{
                this.getInfo()
                this.$message({
                    message: '修改成功',
                    type: 'success',
                });
            })
        }
    }
}
</script>


<style lang="scss">
.setupPage {
  width: 100%;
  height: calc(100vh - 186px);
  background: #fff;
  padding: 20px;
  .flex {
    display: flex;
    align-items: center;
    margin-top: 20px;
  }
}
.btn {
    width: 100px;
    height: 32px;
    border-radius: 4px;
    background: #0052D9;
    line-height: 32px;
    text-align: center;
    color: #fff;
    margin-top: 20px;
    cursor: pointer;
}
</style>